﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BusinessLogic;
using BaseEntities;
using DataAccess;
using System.Data;

namespace TestProject
{
    class TestValidate
    {
        [TestMethod]
        public void TestValidateCard()
        {
            Card c = new Card();
            c.CardNo = "";
            bool expected = DataAccess.CardDataAccess.ValidateCard(c);
            bool actual;
            actual = CardBus.ValidateCard(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidateCard2()
        {
            Card c = new Card();
            c.CardNo = "12345678912345678394823948328423423";
            bool expected = DataAccess.CardDataAccess.ValidateCard(c);
            bool actual;
            actual = CardBus.ValidateCard(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN()
        {
            Card c = new Card();
            c.CardNo = "0987654321234567";
            c.PIN = "";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN1()
        {
            Card c = new Card();
            c.CardNo = "0987654321234567";
            c.PIN = "1";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN2()
        {
            Card c = new Card();
            c.CardNo = "0987654321234567";
            c.PIN = "123456";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN3()
        {
            Card c = new Card();
            c.CardNo = "0987654321234567";
            c.PIN = "123456";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN4()
        {
            Card c = new Card();
            c.CardNo = "0987654321234567";
            c.PIN = "1244";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN5()
        {
            Card c = new Card();
            c.CardNo = "0987654321234567";
            c.PIN = "1232432432434534534543543";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN6()
        {
            Card c = new Card();
            c.CardNo = "1237876543123456";
            c.PIN = "1232432432434534534543543";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN7()
        {
            Card c = new Card();
            c.CardNo = "1237876543123456";
            c.PIN = "1232432432434534534543543";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN8()
        {
            Card c = new Card();
            c.CardNo = "1237876543123456";
            c.PIN = "1232432432434534534543543";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN9()
        {
            Card c = new Card();
            c.CardNo = "1237876543123456";
            c.PIN = "1232432432434534534543543";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void TestValidatePIN10()
        {
            Card c = new Card();
            c.CardNo = "1237876543123456";
            c.PIN = "1232432432434534534543543";
            bool expected = DataAccess.CardDataAccess.ValidatePIN(c);
            bool actual;
            actual = CardBus.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }

        
        [TestMethod]
        public void ValidateCard()
        {
            Card c = new Card();
            c.CardNo = "1237876543123456";
            bool expected = true;
            bool actual = DataAccess.CardDataAccess.ValidateCard(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void ValidateCard1()
        {
            Card c = new Card();
            c.CardNo = "14342";
            bool expected = false;
            bool actual = DataAccess.CardDataAccess.ValidateCard(c);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void ValidatePIN()
        {
            Card c = new Card();
            c.CardNo = "1237876543123456";
            c.PIN = "123456";
            bool expected = true;
            bool actual = DataAccess.CardDataAccess.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }
        [TestMethod]
        public void ValidatePIN1()
        {
            Card c = new Card();
            c.CardNo = "1237876543123456";
            c.PIN = "1234567890";
            bool expected = false;
            bool actual = DataAccess.CardDataAccess.ValidatePIN(c);
            Assert.AreEqual(expected, actual);
        }
    }
}
